#ifndef F_CASGIE_h
#define F_CASGIE_h


//******************************************************************************
// EDROOM Service Library

#define _EDROOM_IS_DEBUG_

#define _EDROOM_IS_EMBEDDED_

#include <public/edroomsl.h>

// Data Classes

#include <public/cddoublepacklist.h>
// Data Classes

#include <public/cdtmtccommserver.h>
// Data Classes

#include <public/cddataburst.h>
// Data Classes

#include <public/cdburst.h>

//******************************************************************************
// Required Software Interfaces

#include <casgi/required_swi.h>
//******************************************************************************
// Component Class   CASGI

class CASGI: public CEDROOMComponent {

public:

	//*********************** Component Signal Enum Type ***********************

	 enum EDROOMCASGISignal { EDROOMSignalTimeout, EDROOMSignalDestroy, SKeepOnComm, SToStandBy, STMToTransmit, SToComm, SInStandBy, STMTransmited, SCommConfigured, STCReceived, SCommInterrupted, STMTCPackList, SFreePackList, STMDoublePackList, SFinalTCPackets, STCPackList, SNoAnswer, SRxBurst, SRxDataBurst, SAnswer, STxBurst, STxDataBurst };

	//***************************** Component Memory ***************************

	class CEDROOMMemory: public CEDROOMComponentMemory{

		private:

			//CQueueHead

			CEDROOMQueue::CQueueHead QueueHeads[EDROOMprioMINIMUM+1];

			//TimingMemory

			CEDROOMTimerInfo TimerInf[5];
			TEDROOMBool TimerInfMarks[5];
			CEDROOMTimeOutMessage TimeOutMess[5];
			TEDROOMBool TimeOutMessMarks[5];

		public: 

			CEDROOMTimingMemory TimingMemory;

			//Pools

			public:

			CDTMTCCommServer	poolCDTMTCCommServer[3];
			TEDROOMBool	poolMarkCDTMTCCommServer[3];
			CDDataBurst	poolCDDataBurst[3];
			TEDROOMBool	poolMarkCDDataBurst[3];
			CDBurst	poolCDBurst[3];
			TEDROOMBool	poolMarkCDBurst[3];
			TEDROOMWord16	poolTEDROOMWord16[3];
			TEDROOMBool	poolMarkTEDROOMWord16[3];


			// SetMemory
			void SetMemory(TEDROOMUInt32 numMessages_, CEDROOMMessage * MessagesMem_, TEDROOMBool * MessagesMemMarks_, CEDROOMQueue::CQueueNode * QueueNodesMem_, TEDROOMBool * QueueNodesMemMarks_);

	};


	//*****************************	Component Ports ****************************

	CEDROOMInterface	PlannerSGIControl;
	CEDROOMInterface	SgiTMTCServer;
	CEDROOMInterface	SGIComm;


	// ****************************	Timing SAP *********************************

	CEDROOMTimingSAP	 EDROOMtimingSAP;


	// *****************************	Timing Interfaces **********************

	CEDROOMTimingInterface	SATReadyTimer;
	CEDROOMTimingInterface	TxRxBurstTimer;




	// ******************************** Constructor ****************************

	CASGI(const char * const roomname, TEDROOMComponentID id, TEDROOMUInt32 roomNumMaxMens, TEDROOMPriority roomtaskPrio, TEDROOMStackSizeType roomStack, CEDROOMMemory * pActorMemory );




	// *************************************************************************

	// **************************** Public Methods	****************************

	// *************************************************************************



	// **************************** Configuration ******************************

	 int EDROOMConfig();


	// ************************************* Start *****************************

	 int EDROOMStart();




	#ifdef _EDROOM_SYSTEM_CLOSE

	// ***************************** IsComponentFinished ***********************

	TEDROOMBool EDROOMIsComponentFinished();


	#endif

	// *************************************************************************

	// **************************** Protected Methods	************************

	// *************************************************************************

protected:



	// *********************************** Behaviour ***************************

	virtual void EDROOMBehaviour();




public:

	// *****************************	Behaviour File *************************

	#include <casgi/CASGIC.h>


protected:

	// ********************************  Top State  ****************************

	EDROOMTopState edroomTopState;



};
#endif
